package com.wicket.okrframework.biz.service.nb;

import cn.hutool.core.bean.BeanUtil;
import com.wicket.okrcomponent.common.annotations.BanAuto;
import com.wicket.okrframework.biz.service.dto.common.MergeInductionRecordDto;
import com.wicket.okrframework.biz.service.dto.common.PerOrgInductionRecordDto;
import com.wicket.okrframework.biz.service.dto.req.GenerateMergePostGradesStationTypeReqDto;
import com.wicket.okrframework.biz.service.dto.req.GenerateMergePostStationReqDto;
import com.wicket.okrframework.biz.service.dto.req.UpdateMergeInductionRecordReqDto;
import com.wicket.okrframework.biz.service.dto.res.GenerateMergePostGradesStationTypeRespDto;
import com.wicket.okrframework.biz.service.dto.res.GenerateMergePostStationRespDto;
import com.wicket.okrframework.biz.service.dto.res.OrgInductionRecordDto;
import com.wicket.okrframework.biz.service.dto.res.UpdateMergeInductionRecordRespDto;
import org.apache.skywalking.apm.toolkit.trace.Tag;
import org.apache.skywalking.apm.toolkit.trace.Tags;
import org.apache.skywalking.apm.toolkit.trace.Trace;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
import com.wicket.okrframework.biz.service.dto.req.QueryReceiveFieldDetailReqDto;
import com.wicket.okrframework.biz.service.dto.res.QueryReceiveFieldDetailRespDto;

/**
 * @author ： 手工接入方法
 * @since 2022/5/28 15:32
 *
 *
 * @version 1.0
 */
@Service
public class NbInductionRecord {
    /**
     * code:abc
     * name:M合并就职记录（特殊方法）
     * desc:undefined
     **/
    @BanAuto
    @Trace(operationName = "M合并就职记录（特殊方法）")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    public UpdateMergeInductionRecordRespDto updateMergeInductionRecord(UpdateMergeInductionRecordReqDto reqDto) {
        UpdateMergeInductionRecordRespDto retData = new UpdateMergeInductionRecordRespDto();
        List<String> filteredList = new ArrayList<>();
        for (OrgInductionRecordDto oneOrg : reqDto.getOrgInductionRecordList()) {
            if (!filteredList.contains(oneOrg.getInductionRecordId())) {
                MergeInductionRecordDto mergedElm = new MergeInductionRecordDto();
                BeanUtil.copyProperties(oneOrg, mergedElm);
                retData.getMergeInductionRecordList().add(mergedElm);
                filteredList.add(oneOrg.getInductionRecordId());
            }
        }

        for (PerOrgInductionRecordDto oneOrg : reqDto.getPerOrgInductionRecordList()) {
            if (!filteredList.contains(oneOrg.getInductionRecordId())) {
                MergeInductionRecordDto mergedElm = new MergeInductionRecordDto();
                BeanUtil.copyProperties(oneOrg, mergedElm);
                retData.getMergeInductionRecordList().add(mergedElm);
                filteredList.add(oneOrg.getInductionRecordId());
            }
        }

        return retData;
    }

    /**
     * code:collectionsAggregation
     * name:M合并职位岗位(特殊方法）
     * desc:undefined
     **/
    @Trace(operationName = "M合并职位岗位(特殊方法）")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    public GenerateMergePostStationRespDto generateMergePostStation(GenerateMergePostStationReqDto reqDto) {
        // TODO ruizhe skai dong ; 2022/6/19上午1:50:49
        return new GenerateMergePostStationRespDto();
    }

    /**
     * code:collectionsAggregation
     * name:M合并职级岗位类型（特殊方法）
     * desc:undefined
     **/
    @Trace(operationName = "M合并职级岗位类型（特殊方法）")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    public GenerateMergePostGradesStationTypeRespDto generateMergePostGradesStationType(GenerateMergePostGradesStationTypeReqDto reqDto) {
        // TODO ruizhe skai dong ; 2022/6/19上午1:59:03
        return new GenerateMergePostGradesStationTypeRespDto();
    }
/**
      * code:receptionService
      * name:M1-获取接收字段（特殊方法）
      * desc:undefined
      * gen by moon at 8/26/2022, 3:03:43 PM
      * 
      **/
     @Trace(operationName = "M1-获取接收字段（特殊方法）")
     @Tags({@Tag(key = "参数",value = "arg[0]"),
     @Tag(key = "返回值",value = "returnedObj")})
      public QueryReceiveFieldDetailRespDto queryReceiveFieldDetail(QueryReceiveFieldDetailReqDto reqDto) {
        return BeanUtil.toBean(reqDto,QueryReceiveFieldDetailRespDto.class);
      }
    // 手工接入方法
}
